use validator::Validate;
use crate::domain::UserBean;
use serde::{Deserialize, Serialize};
use core::fmt::Debug;

#[derive(Debug, Deserialize, Validate)]
#[serde(rename_all = "camelCase")]
pub struct LoginInput {
	pub user_name: String,
	pub password: String,
}

#[derive(Debug, Deserialize, Validate)]
#[serde(rename_all = "camelCase")]
pub struct RegisterInput {
	#[validate(length(min = 4, max = 10))]
	pub user_name: String,
	#[validate(email)]
	pub email: String,
	#[validate(length(min = 6))]
	pub password: String,
}

//#[derive(Debug, SimpleObject)]
#[derive(Debug)]
pub struct AuthPayload {
	pub token: String,
	pub user: UserBean,
}

#[derive(Debug, Serialize)]
pub struct TokenPayload {
	pub success:bool,
	pub token: String,
}
